package com.wonders.controller;
import com.wonders.dto.Result;
import com.wonders.service.IFollowService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;

/**
 * 功能描述:关注、取关、共同关注等相关业务
 * @Author: yyalin
 * @CreateDate: 2023/8/14 13:17
 */
@Api(tags="关注、取关、共同关注等相关业务")
@RestController
@RequestMapping("/follow")
public class FollowController {
    @Resource
    private IFollowService followService;

    @ApiOperation(value="关注、取关功能", notes="follow")
    @PutMapping("/{id}/{isFollow}/{userId}")
    public Result follow(@PathVariable("id") Long followUserId,
                         @PathVariable("isFollow") Boolean isFollow,
                         @PathVariable("userId") Long userId) {
        return followService.follow(followUserId, isFollow,userId);
    }

    @ApiOperation(value="查询是否关注功能", notes="isFollow")
    @GetMapping("/or/not/{followUserId}/{userId}")
    public Result isFollow(@PathVariable("followUserId") Long followUserId,
                           @PathVariable("followUserId")Long userId) {
        return followService.isFollow(followUserId,userId);
    }

    @ApiOperation(value="共同关注", notes="followCommons")
    @GetMapping("/common/{userId01}/{userId02}")
    public Result followCommons(@PathVariable("userId01") Long userId01,
                                @PathVariable("userId02") Long userId02){
        return followService.followCommons(userId01,userId02);
    }
}
